﻿namespace TfsCloudDeploy.Workflow.Core.Activities
{
    using System;
    using System.ComponentModel;
    using System.Reflection;

    /// <summary>
    /// Reflected from: Microsoft.TeamFoundation.Build.Workflow.Activities.SRCategoryAttribute.
    /// Assembly: Microsoft.TeamFoundation.Build.Workflow, Version=10.0.0.0.
    /// </summary>
    [AttributeUsage(AttributeTargets.All)]
    internal sealed class SRCategoryAttribute : CategoryAttribute
    {
        // Fields
        private const BindingFlags GetBindingFlags = (BindingFlags.Public | BindingFlags.Static);
        private Type m_type;

        // Methods
        public SRCategoryAttribute(Type type, string category)
            : base(category)
        {
            this.m_type = type;
        }

        protected override string GetLocalizedString(string value)
        {
            return (string)this.m_type.GetMethod("Get", BindingFlags.Public | BindingFlags.Static).Invoke(null, new object[] { value });
        }
    }
}
